package com.nick.sscplan;

import com.nick.sscplan.bean.SscInfo;

public class SscOperation {

    public static class Last_one {

        /**
         * When any position is 0, three plan:0369
         * @param num:A complete lottery results 
         * @return 0369
         */
        public static String h11(int num) {
            switch (num) {
            case 0:
                return "0,3,6,9";
            }
            return "";
        }
        
        /**
         * The last three numbers square divided 32.
         * @param num:A complete lottery results
         * @return
         */
        public static String h12(Integer num){
            /*int size = num.toString().length();
            int b = 10;
            int c;
            for (int i = 0; i < size; i++) {
                c = num % b;
                num /= b;
            }*/
            int x = num % 1000;
            int result = x * x / 32;
            
            return "后一三胆三期计划:" + result;
        }
        
        /**
         * When any position is 0, three plan:0369
         * @param sscInfo
         * @return 0369
         */
        public static String h11(SscInfo sscInfo) {
            if (sscInfo.getData1() == 0 || sscInfo.getData2() == 0 || sscInfo.getData3() == 0 || sscInfo.getData4() == 0 || sscInfo.getData5() == 0) {
                return "0,3,6,9";
            }
            return "";
        }
        
        /**
         * The last three numbers square divided 32.
         * Three plan.
         * @param sscInfo
         * @return
         */
        public static String h12(SscInfo sscInfo){
            /*int size = num.toString().length();
            int b = 10;
            int c;
            for (int i = 0; i < size; i++) {
                c = num % b;
                num /= b;
            }*/
            int num = sscInfo.getData3() * 100 + sscInfo.getData4() * 10 + sscInfo.getData5();
            int x = num % 1000;
            int result = x * x / 32;
            
            return "后一三胆三期计划:" + result;
        }
        
        /**
         * The last number's 012 road,return the other two number and relative number's;
         * Four plan.
         * @param sscInfo
         * @return
         */
        public static String h13(SscInfo sscInfo){
            int num = sscInfo.getData5();
            switch (num) {
            case 1:
            case 6:
                return "3,4,7,9";
                
            case 2:
            case 7:
                return "1,4,5,8";
                
            case 3:
            case 8:
                return "2,5,6,9";
                
            case 4:
            case 9:
                return "1,3,6,7";
                
            case 5:
            case 0:
                return "2,3,6,8";

            }
            return "";
            
            
        }
        
        /**
         * Sum of last three numbers and get the last number.
         * The last number add and subtraction two,return result and relative numbers.
         * Four plan.
         * @param sscInfo
         * @return
         */
        public static String h14(SscInfo sscInfo){
            int num = sscInfo.getData5();
            switch (num) {
            case 1:
            case 6:
                return "3,4,8,9";
                
            case 2:
            case 7:
                return "0,4,5,9";
                
            case 3:
            case 8:
                return "2,5,6,9";
                
            case 4:
            case 9:
                return "1,3,6,7";
                
            case 5:
            case 0:
                return "2,3,6,8";

            }
            return "";
            
            
        }
        
        
        
    }
    
    public static class Last_three_any{
        
        
        /**
         * Results according to the hundred and ten numbers.
         * Three plan.
         * @param sscInfo
         * @return
         */
        public static String h31(SscInfo sscInfo){
            
            int hun = sscInfo.getData3();
            int ten = sscInfo.getData4();
            
            int num = hun * 10 + ten;
            if (num == 0 || num == 2 || num == 37 || num == 60 || num == 62) {
                return "5,8";
            }else if (num == 1 || num == 7 || num == 61 || num == 67) {
                return "0,5";
            }else if (num == 3 || num == 27 || num == 63) {
                return "5,9";
            }else if (num == 4 || num == 5 || num == 6 || num == 64 || num == 65 || num == 66 || num == 77 || num == 87 || num == 97) {
                return "1,5";
            }else if (num == 8 || num == 17 || num == 47 || num == 68) {
                return "5,6";
            }else if (num == 9 || num == 69) {
                return "5,7";
            }else if (num == 10 || num == 12 || num == 38 || num == 40 || num == 42) {
                return "6,8";
            }else if (num == 11 || num == 18 || num == 41) {
                return "0,6";
            }else if (num == 13 || num == 28 || num == 43) {
                return "6,9";
            }else if (num == 14 || num == 15 || num == 16 || num == 44 || num == 45 || num == 46 || num == 78 || num == 84 || num == 98) {
                return "1,6";
            }else if (num == 19 || num == 48 || num == 49) {
                return "6,7";
            }else if (num == 20 || num == 22 || num == 33) {
                return "8,9";
            }else if (num == 21 || num == 23) {
                return "0,9";
            }else if (num == 24 || num == 25 || num == 26 || num == 73 || num == 83 || num == 93) {
                return "1,9";
            }else if (num == 29) {
                return "7,9";
            }else if (num == 30 || num == 32) {
                return "3,8";
            }else if (num == 31) {
                return "0,8";
            }else if (num == 34 || num == 35 || num == 36 || num == 70 || num == 72 || num == 80 || num == 82 || num == 86 || num == 90 || num == 92) {
                return "1,8";
            }else if (num == 39) {
                return "7,8";
            }else if (num == 41) {
                return "0,6";
            }else if (num == 50 || num == 52) {
                return "4,8";
            }else if (num == 51) {
                return "0,4";
            }else if (num == 53) {
                return "4,9";
            }else if (num == 54 || num == 55 || num == 56 || num == 76 || num == 96) {
                return "1,4";
            }else if (num == 57) {
                return "4,5";
            }else if (num == 58) {
                return "4,6";
            }else if (num == 59) {
                return "4,7";
            }else if (num == 71 || num == 81 || num == 91) {
                return "0,1";
            }else if (num == 74 || num == 94) {
                return "1,2";
            }else if (num == 75 || num == 95) {
                return "1,3";
            }else if (num == 79 || num == 85 || num == 89 || num == 99) {
                return "1,7";
            }else {
                return "";
            }
        }
    }

}
